home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 613 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  2.3 KB

  1. From: hickeyr@ibm.net (Rich Hickey)
  2. Message-ID: <4h9ii0$3mlq@news-s01.ny.us.ibm.net>
  3. X-Original-Date: 2 Mar 1996 13:30:39 GMT
  4. Path: in1.uu.net!bounce-back
  5. Date: 02 Mar 96 16:56:53 GMT
  6. Approved: fjh@cs.mu.oz.au
  7. Organization: -
  8. Newsgroups: comp.std.c++
  9. Subject: Re: Generic Object Callbacks
  10. X-Newsreader: NeoLogic News for OS/2 [version: 4.2]
  11. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  12.     iQBFAgUBMTh+FOEDnX0m9pzZAQFozgF/ZLcEAv/k/g4xYDhyRcRszBjvJ6SWHCwd
  13.     l7oVEFxvzNvuu/WZUMoIEJp09yf8lQ9h
  14.     =Xbtu
  15.  
  16. In message <4h5j7b$1ur@bcarh8ab.bnr.ca> - "ian (i.) willmott" 
  17. <willmott@bnr.ca> writes:
  18.  
  19. :>The original article (this has expired on my site and possibly others
  20. :>as well; maybe I should repost it) suggests a new type
  21. :>"pointer-to-bound-member-function" which would encapsulate an object
  22. :>pointer and a pointer to a member function of that class.
  23.  
  24. Having previously considered the suggestion you proposed and forced to solve 
  25. the problem in current language, and with a lot of experience using a
  26. current-language solution, I feel it is actually preferable to the extension 
  27. you propose in the following areas:
  28.  
  29. A)It is more type-flexible. By that I mean it is possible to produce a 
  30. callback system that is type-safe, yet tolerant of type differences in the 
  31. caller/callee signatures that are either implicitly convertible or can be 
  32. ignored. For example if the caller requires a function to which it can pass 
  33. an int and from which it expects nothing, using my library it is possible to 
  34. bind the callback to a function that takes an int and returns an int (return 
  35. value is ignored), or takes a long and returns void (compiler implicitly 
  36. converts int->long). Once you get involved with polymorphism this becomes 
  37. critical: caller passes ptr-to-derived, callee accepts ptr-to-base. Any 
  38. language extension approach would have the rigidity normally associated with 
  39. pointers-to-functions, i.e. exactly matching signatures required. 
  40.  
  41. B)It is easier to extend; to things like callbacks with stored arguments 
  42. etc.
  43.  
  44. Rich
  45. ---
  46. [ To submit articles: try just posting with your news-reader.
  47.                       If that fails, use mailto:std-c++@ncar.ucar.edu
  48.   FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html
  49.   Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html
  50.   Comments? mailto:std-c++-request@ncar.ucar.edu.
  51. ]
  52.